/*
 * 敵初期化
 */
void
enemyinit(int i,int num)
	{
	int	j;

	for ( j = 0 ; j < MAXENEMY ; j++ )
		{
		if ( enemy[j].flag == 0 )
			{
			enemy[j].flag = 1;
			enemy[j].type = num;
			if ( enemy[j].type == E_ENGINE )
				{
				// エンジン
 				oe[j].geometryTop = cube4;
				oe[j].geometryLength = sizeof(cube4) / sizeof(int);
				oe[j].material = NULL;
				enemy[j].x = i * MAPSTEP + MAPSTEP/2;
				enemy[j].y = random(5)*MAPSTEP + 0x10;
				enemy[j].z = FSZ - 0x04;
				enemy[j].score = 100;
				enemy[j].xsize = MAPSTEP-0x10;
				enemy[j].ysize = MAPSTEP-0x10;
				enemy[j].zsize = MAPSTEP-0x10;
				enemy[j].hp = 1;
				enemy[j].xspeed = 0;
				enemy[j].yspeed = 0;
				enemy[j].zspeed = -BASESPEED;
				}
			else if ( enemy[j].type == E_RING )
				{
				// リング
 				oe[j].geometryTop = cube5;
				oe[j].geometryLength = sizeof(cube5) / sizeof(int);
				oe[j].material = NULL;
				enemy[j].x = i * MAPSTEP + MAPSTEP/2;
				enemy[j].y = random(5)*MAPSTEP + 0x10;
				enemy[j].z = 0x40;
				enemy[j].score = 150;
				enemy[j].xsize = MAPSTEP-0x10;
				enemy[j].ysize = MAPSTEP-0x10;
				enemy[j].zsize = MAPSTEP-0x10;
				enemy[j].hp = 1;
				enemy[j].xspeed = 0;
				enemy[j].yspeed = 0;
				enemy[j].zspeed = 50;
				}
			else if ( enemy[j].type == E_PIRAMID )
				{
				// ピラミッド
 				oe[j].geometryTop = cube6;
				oe[j].geometryLength = sizeof(cube6) / sizeof(int);
				oe[j].material = NULL;
				enemy[j].x = i * MAPSTEP + MAPSTEP/2;
				enemy[j].y = -0x30;
				enemy[j].z = FSZ - 0x04;
				enemy[j].score = 100;
				enemy[j].xsize = MAPSTEP - 0x20;
				enemy[j].ysize = MAPSTEP + 0x40;
				enemy[j].zsize = MAPSTEP - 0x20;
				enemy[j].hp = 100;
				enemy[j].xspeed = 0;
				enemy[j].yspeed = 0;
				enemy[j].zspeed = -BASESPEED;
				}
			else if ( enemy[j].type == E_ROCK )
				{
				// 鉄球
 				oe[j].geometryTop = cube11;
				oe[j].geometryLength = sizeof(cube11) / sizeof(int);
				oe[j].material = NULL;
				if ( i < 3 )
					{
					enemy[j].x = 0;
					enemy[j].xspeed = 10;
					}
				else
					{
					enemy[j].x = 6 * MAPSTEP;
					enemy[j].xspeed = -10;
					}
				enemy[j].y = FSY - 0x10;
				enemy[j].z = FSZ - random(100) - 0x80;
				enemy[j].score = 1000;
				enemy[j].xsize = MAPSTEP - 0x10;
				enemy[j].ysize = MAPSTEP - 0x10;
				enemy[j].zsize = MAPSTEP - 0x10;
				enemy[j].hp = 10;
				enemy[j].yspeed = -4;
				enemy[j].zspeed = -BASESPEED;
				}
			else if ( enemy[j].type == E_SNOW )
				{
				// 雪
 				oe[j].geometryTop = cube12;
				oe[j].geometryLength = sizeof(cube12) / sizeof(int);
				oe[j].material = NULL;
				enemy[j].x = random(FSX);
				enemy[j].xspeed = random(4)-random(4);
				enemy[j].y = FSY - 0x08;
				enemy[j].z = FSZ - random(100) - 0x100;
				enemy[j].score = 250;
				enemy[j].xsize = MAPSTEP - 0x30;
				enemy[j].ysize = MAPSTEP - 0x30;
				enemy[j].zsize = MAPSTEP - 0x30;
				enemy[j].hp = 1;
				enemy[j].yspeed = -random(10) - 5;
				enemy[j].zspeed = -BASESPEED;
				}
			else if ( enemy[j].type == E_POLE )
				{
				// 柱
 				oe[j].geometryTop = cube13;
				oe[j].geometryLength = sizeof(cube13) / sizeof(int);
				oe[j].material = NULL;
				enemy[j].x = i * MAPSTEP + MAPSTEP/2;
				enemy[j].y = -0xf0;
				enemy[j].z = 0x40;
				enemy[j].score = 200;
				enemy[j].xsize = MAPSTEP - 0x28;
				enemy[j].ysize = MAPSTEP*8;
				enemy[j].zsize = MAPSTEP - 0x28;
				enemy[j].hp = 10;
				enemy[j].xspeed = 0;
				enemy[j].yspeed = 0;
				enemy[j].zspeed = 50;
				}
			else if ( enemy[j].type == E_MSL )
				{
				// BOSS III ミサイル
 				oe[j].geometryTop = cube15;
				oe[j].geometryLength = sizeof(cube15) / sizeof(int);
				oe[j].material = NULL;
				enemy[j].x = random(FSX);
				enemy[j].y = random(FSY);
				enemy[j].z = FSZ  - 0x100;
				enemy[j].score = 0;
				enemy[j].xsize = MAPSTEP - 0x28;
				enemy[j].ysize = MAPSTEP - 0x28;
				enemy[j].zsize = MAPSTEP - 0x28;
				enemy[j].hp = 2;
				enemy[j].xspeed = (ship.x - enemy[j].x) / 0x20;
				enemy[j].yspeed = (ship.y - enemy[j].y) / 0x20;
				enemy[j].zspeed = (ship.z - enemy[j].z) / 0x20;
				}
			break;
			}
		}
	}

